/* Main window class */

#ifndef MC_MAIN_WINDOW_HPP
#define MC_MAIN_WINDOW_HPP

#include <sigc++/sigc++.h>

#include <glibmm/dispatcher.h>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>

#include <gtkmm/actiongroup.h>
#include <gtkmm/alignment.h>
#include <gtkmm/box.h>
#include <gtkmm/combobox.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/statusbar.h>
#include <gtkmm/window.h>
#include <gtkmm/toolbutton.h>
#include <gtkmm/uimanager.h>

#include "gtk_data_sink.hpp"
#include "memory_chart.hpp"

namespace memchart
{
	class MainWindow : public Gtk::Window
	{
		public:

			MainWindow (gtk_data_sink & main_thread);

		private:

			/* Signal handlers */
			void on_start ();
			void on_close ();
			void on_main_quit ();
			void on_hide ();
			void on_update ();
			void on_menu_continue ();
			void on_menu_fullscreen ();
			void on_menu_save ();
			void on_menu_copy ();
			
			void status_message (const Glib::ustring & s);
			bool on_status_timeout ();

			void call_update ();

			gtk_data_sink &                 main_thread;

			/* Inter-thread signal dispatchers */
			Glib::Dispatcher                signal_update, signal_quit;

			sigc::connection                status_timeout;

			/* Child widgets */
			Gtk::VBox                       vbox;

			Glib::RefPtr<Gtk::UIManager>    ui_manager;
			Glib::RefPtr<Gtk::ActionGroup>  menu;
			Glib::RefPtr<Gtk::Action>       continue_action, fullscreen_action;

			Gtk::ScrolledWindow             chart_window;
			Gtk::EventBox                   chart_evbox;
			Gtk::Alignment                  chart_align;
			MemoryChart                     chart;

			Gtk::ComboBox                   layout_list;

			Gtk::Statusbar                  status_bar;
	};
}

#endif /* MC_MAIN_WINDOW_HPP */
